package visitor;

import java.util.ArrayList;
import java.util.List;

public class Computer implements ComputerPart {

    List<ComputerPart> computerParts = new ArrayList<>();

    @Override
    public void add(ComputerPart computerPart) {
        computerParts.add(computerPart);
    }

    @Override
    public void accept(Visitor visitor) {
        visitor.visit(this);
        for (ComputerPart computerPart : computerParts) {
            computerPart.accept(visitor);
        }
    }

    @Override
    public void display() {
        System.out.println("computer");
    }
}
